package com.shanjupay.paymentagent.config;

import com.github.wxpay.sdk.IWXPayDomain;
import com.github.wxpay.sdk.WXPayConfig;
import com.github.wxpay.sdk.WXPayConstants;

import java.io.InputStream;

public class MyWXPayconfig extends WXPayConfig {

    private byte[] certData;

    public MyWXPayconfig() throws Exception {
     /*   String certPath = "/path/to/apiclient_cert.p12";
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();*/
    }

    public String getAppID() {
        return "wxd2bf2dba2e86a8c7";
    }


    public String getAppSecret() {
        return "cec1a9185ad435abe1bced4b93f7ef2e";
    }

    public String getMchID() {
        return "1502570431";
    }

    //生产
    public String getKey() { return "95fe355daca50f1ae82f0865c2ce87c8"; }

    //沙盒
    //public String getKey() { return "b598c9f0cfba6e8f22d0cae13bb2fdf5";}

    public InputStream getCertStream() {
      /*  ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);*/
        return null;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

    @Override
    protected IWXPayDomain getWXPayDomain() {
        return new IWXPayDomain() {
            @Override
            public void report(String s, long l, Exception e) {

            }

            @Override
            public DomainInfo getDomain(WXPayConfig wxPayConfig) {
                return new DomainInfo(WXPayConstants.DOMAIN_API, true);
            }
        };
    }
}
